package com.haixiaoke.saas.repository.mapper;

import com.haixiaoke.saas.repository.pojo.Order;
import com.haixiaoke.saas.repository.vo.HouseConditionVO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 订单Mapper接口
 *
 * @author haixiaoke
 * @date 2023-04-12
 */
@Mapper
public interface OrderMapper {
    /**
     * 查询订单
     *
     * @param orderId 订单主键
     * @return 订单
     */
    Order selectOrderByOrderId(String orderId);

    /**
     * 查询订单列表
     *
     * @param order 订单
     * @return 订单集合
     */
    List<Order> selectOrderList(Order order);

    /**
     * 新增订单
     *
     * @param order 订单
     * @return 结果
     */
    int insertOrder(Order order);

    /**
     * 修改订单
     *
     * @param order 订单
     * @return 结果
     */
    int updateOrder(Order order);

    /**
     * 删除订单
     *
     * @param orderId 订单主键
     * @return 结果
     */
    int deleteOrderByOrderId(Long orderId);

    /**
     * 批量删除订单
     *
     * @param orderIds 需要删除的数据主键集合
     * @return 结果
     */
    int deleteOrderByOrderIds(Long[] orderIds);

    /**
     * 修改订单的状态
     * @param order
     * @return
     */
    int updateOrderState(Order order);

    /**
     * reservationId查询订单
     *
     * @param reservationId 预定人
     * @return Order
     */
    List<Order> selectOrderByReservationId(String reservationId);

    List<Order> selectOrderListValid(Order order);

    /**
     * 查询订单状态
     * @param orderId
     * @return
     */
    Order selectOrderStateById(String orderId);

    List<Order> selectOrderByOrderState(Integer orderState);

    int updateReLetOrder(Order order);

    List<Order> selectOrderListByHouseIds(String[] houseIdList);

    Order selectOrderByHouseId(String houseId);

    List<Order> selectOrderByIds(String[] orderIds);

    /**
     * 房态查询指定范围的订单
     * @param order
     * @return
     */
    List<HouseConditionVO> selectOrderCondition(Order order);
    List<HouseConditionVO> selectOrderConditionOut(Order order);
}
